package com.fh.modules.kms.entity;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * @Author qiujunda
 * @Date 20/05/2020
 * @Description
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@Document(indexName = "kmp",type = "_doc")
public class Knowledge {
    @Id
    private Long id;

    @Field(type = FieldType.Keyword)
    private String createBy;

    @Field(type = FieldType.Keyword)
    private String createName;

    @Field(type = FieldType.Date)
    private Date createTime;

    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String content;

    @Field(type = FieldType.Integer)
    private Integer type;

    @Field(type = FieldType.Keyword)
    private String typeName;

    public Knowledge(Long id,String createBy,String content,Integer type){
        this.id=id;
        this.createBy=createBy;
        this.content=content;
        this.type=type;
        this.createTime=new Date();
    }
    public Knowledge(Long id,String createBy,String content,Integer type,Date createTime){
        this.id=id;
        this.createBy=createBy;
        this.content=content;
        this.type=type;
        this.createTime=createTime;
    }
}
